/*
 * @Description: 隧道接口
 * @Author: Huang Junjie
 * @Date: 2021-04-09 09:25:12
 * @LastEditTime: 2021-09-28 12:43:19
 * @LastEditors: Huang Junjie
 */
import request from '@/utils/request'

// 查询列表信息
export function getListPage(query) {
  var params = JSON.parse(JSON.stringify(query))
  delete params.unitCodeParams
  return request({
    url: query.unitCodeParams ? ('/jcwBasic' + query.unitCodeParams + '/jcTunnel/pageData') : '/jcwBasic/jcTunnel/pageData',
    method: 'GET',
    params: params
  })
}

// 根据id查询信息
export function getInfoById(query) {
  var params = JSON.parse(JSON.stringify(query))
  delete params.unitCodeParams
  return request({
    url: query.unitCodeParams ? ('/jcwBasic' + query.unitCodeParams + `/jcTunnel/getById`) : `/jcwBasic/jcTunnel/getById`,
    method: 'GET',
    params: params
  })
}

// 新增/修改信息
export function addOrEditData(query) {
  var params = JSON.parse(JSON.stringify(query))
  delete params.unitCodeParams
  return request({
    url: query.unitCodeParams ? ('/jcwBasic' + query.unitCodeParams + '/jcTunnel/saveOrUpdateData') : '/jcwBasic/jcTunnel/saveOrUpdateData',
    method: 'POST',
    data: params
  })
}

// 删除信息
export function deleteData(query) {
  var params = JSON.parse(JSON.stringify(query))
  delete params.unitCodeParams
  return request({
    url: query.unitCodeParams ? ('/jcwBasic' + query.unitCodeParams + `/jcTunnel/delete/${params.id}`) : `/jcwBasic/jcTunnel/delete/${params.id}`,
    method: 'DELETE'
  })
}

// 查询隧道字典信息列表
export function getDictListPage(query) {
  var params = JSON.parse(JSON.stringify(query))
  delete params.unitCodeParams
  return request({
    url: query.unitCodeParams ? ('/jcwBasic' + query.unitCodeParams + '/jcTunnelDictionary/pageData') : '/jcwBasic/jcTunnelDictionary/pageData',
    method: 'GET',
    params: params
  })
}
